<?php

class PhotosController extends BaseController {
        
    public function indexAction($requestData) {
    	$album = isset($requestData['arg0']) ? $requestData['arg0'] : "";
    	$sports = array("cycling", "running", "mountain-climbing", "swimming", "adventure-racing", "mountain-biking", "ironman");
    	if($album != "" && !in_array($album, $sports)) {
    		$album = pk_album::get(seourl($album), "title");
    		if($album->id > 0) {
    			$this->data['album'] = $album;
    		}
    	}
    	$sportStr = isset($requestData['arg0']) ? $requestData['arg0'] : "";
		$featured = pk_sport::getFeaturedSport($sportStr);
    	$sport = $featured->id;
    	
    	$albums = pk_album::getAlbumsOfSport($sport);
    	if(isset($albums[0])) {
	    	$album = $albums[0];
	    	if($album->type == "feed") {
	    		$photos = pk_photo_feed::getAll(array("album"=>$album->id), array(), 20);
	    		$this->data['type'] = "feed";
	    	} else {
	    		$photos = pk_photo::getAll(array("album"=>$album->id), array(), 20);
	    		$this->data['type'] = "peak";
	    	}
	    	$this->data['photos'] = $photos;
    	} else {
    		$this->data['nodata'] = true;
    	}
    	
    	$this->data['page'] = "photos";
    	$this->data['featuredTitle'] = $featured->name;
    }

}

?>